package main
{
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.geom.Matrix;
	import flash.utils.getTimer;
	
	import resource.ResourceDefinition;
	
	import starling.display.DisplayObjectContainer;
	import starling.display.Image;
	import starling.events.Event;
	import starling.textures.Texture;
	
	public class Main extends DisplayObjectContainer
	{
		private var image:Image;
		
		private var texture:Texture;
		private var i:int = 0;
		public function Main()
		{
			super();
			var bitmap:Bitmap = new ResourceDefinition.CodeTextrue as Bitmap;
			this.texture = Texture.fromBitmap(bitmap);
			this.image = new Image(this.texture);
			this.addChild(this.image);
			this.image.x = 200;
			this.image.y = 50;
			var matrix:Matrix = new Matrix();
//			matrix.translate(,);
//			matrix.tx = -(image.width/2);
//			matrix.ty = -(image.height/2);
//			this.image.transformationMatrix.translate(-image.width/2,-image.height/2);
			this.image.setVertexColor(0,uint(0xffff00));
			this.image.setVertexColor(1,uint(0x00ffff));
			this.image.setVertexColor(2,uint(0xff00ff));
			this.image.setVertexColor(3,uint(0x000000));
			this.image.pivotX = this.image.width >> 1;
			this.image.pivotY = this.image.height >> 1;
			this.addEventListener(Event.ENTER_FRAME,onEnterFrame);
		}
		
		private function onEnterFrame(event:Event):void{
			
			this.image.rotation++;
			i++;
			if(i > 3){
				i = 0;
			}
		}
		
	}
}